@extends('WShop::layout')
@section('content')
    @component('WShop::public.header')
        @slot('page_title'){{$page_title}} @endslot
    @endcomponent
    <div class="mui-content mui-scroll-wrapper" id="pullrefresh">
        <div class="mui-scroll">
            <div class="mui-table-view mui-table-view-chevron mui-bottom mui-daishou">

                <div class="mui-zhuda">

                    <div class="mui-dingdan-list">
                        @if($list->isNotEmpty())
                            <ul class="mui-list-unstyled mui-clearfix" id="pull-load">
                                @foreach($list as $item)
                                    <li class="bg-fff">
                                        <div class="dingdan-list-header">订单编号：{{$item->agent_sn}} <span class="fa fa-angle-right"></span>
                                            @switch($item->status)
                                            @case(0)
                                            <span class="mui-pull-right mui-text-red">待打款</span>
                                            @break
                                            @case(1)
                                            <span class="mui-pull-right mui-text-blue">已打款</span>
                                            @break
                                            @case(2)
                                            <span class="mui-pull-right mui-text-green">已审核</span>
                                            @break
                                            @default
                                            <span class="mui-pull-right mui-text-green">已拒绝</span>
                                            @endswitch
                                        </div>

                                            <div class="flex">
                                                <img src="{{$item->HandUserInfo['receiving_code']}}" alt="" />
                                                <div class="flex-right" style="width: 100%;">
                                                    <div class="flex">
                                                        <div class="mui-ellipsis-2">收款人：{{$item->HandUser['real_name']}}</div>
                                                    </div>
                                                    <div>
                                                        <div style="padding-left: 10px;color: #999;">收款人微信：{{$item->HandUserInfo['weichat']}}</div>
                                                        <div style="padding-left: 10px;color: #999;">收款人电话：{{$item->HandUser['user_phone']}}</div>
                                                        <div style="padding-left: 10px"><span style="margin-right: 50px;">￥{{$item->pay_money}}</span></div>
                                                    </div>
                                                </div>
                                            </div>

                                        <div class="mui-text-right"></div>
                                        @switch($item->status)
                                        @case(0)
                                        <div class="mui-text-right1">
                                            @if($item->user_id == $user_id)
                                            <a href="{{route('f_Wap_Upgrade_apply_match_pay',['order_id'=>$item->id])}}" class="mui-btn">立即付款</a>
                                                @else
                                                <a href="javascript:void (0)" class="mui-btn mui-disabled">未付款</a>
                                            @endif
                                        </div>
                                        @break
                                        @case(1)

                                        <div class="mui-text-right1">
                                            @if($item->hand_uid == $user_id)

                                            <a href="javascript:;"
                                               data-url="{{route('f_Wap_Upgrade_handle',['order_id'=>$item->id,'status'=>2])}}"
                                               class="mui-btn quxiao" style="background-color: green;color: #ffffff;">通过</a>

                                            <a href="javascript:;"
                                               data-url="{{route('f_Wap_Upgrade_handle',['order_id'=>$item->id,'status'=>3])}}"
                                               class="mui-btn quxiao">拒绝</a>

                                            @else
                                                <a href="javascript:void (0)" class="mui-btn quxiao mui-disabled">已付款</a>
                                            @endif

                                            <a href="javascript:;" data-content="{{$item->remark}}" data-img="{{$item->voucher}}" class="mui-btn tixing">收款凭证</a>
                                        </div>

                                        @break
                                        @case(2)
                                        <div class="mui-text-right1"> <a href="javascript:;" data-content="{{$item->remark}}" data-img="{{$item->voucher}}" class="mui-btn tixing">收款凭证</a></div>
                                        @break
                                        @endswitch

                                    </li>
                                @endforeach
                            </ul>
                        @endif
                    </div>

                </div>

            </div>
        </div>
    </div>
    @include('WShop::public.foot_bar',['active'=>'upgrade'])
@endsection
@push('scripts')
    <script>
        $('.tixing').each(function () {
            this.addEventListener('tap',function () {
                var content = "&nbsp;&nbsp;&nbsp;&nbsp;"+$(this).data('content');
                var img_src = $(this).data('img');
                var html = "<div style='margin:0 auto;'><img style='width: 150px;height: 150px;' src="+img_src+" ></div>\n"+
                           "<div style='margin-top: 10px;'>"+content+"</div>"
                layer.open({
                    title: [
                        '查看凭证',
                        'background-color: #1b2c4b; color:#fff;'
                    ],
                    content: html
                });
            });
        });
    </script>

@endpush